{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Most examples work across multiple plotting backends, this example is also available for:\n",
    "\n",
    "* [Matplotlib - scatter_economic](../matplotlib/scatter_economic.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import holoviews as hv\n",
    "from holoviews import dim, opts\n",
    "hv.extension('bokeh')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Declaring data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n",
    "key_dimensions   = [('year', 'Year'), ('country', 'Country')]\n",
    "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n",
    "                    ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n",
    "macro = hv.Table(macro_df, key_dimensions, value_dimensions)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gdp_unem_scatter = macro.to.scatter('Year', ['GDP Growth', 'Unemployment'])\n",
    "overlay = gdp_unem_scatter.overlay('Country')\n",
    "\n",
    "overlay.opts(\n",
    "    opts.Scatter(color=hv.Cycle('Category20'), line_color='k', size=dim('Unemployment')*1.5,\n",
    "                 show_grid=True, padding=0.1, width=700, height=400),\n",
    "    opts.NdOverlay(legend_position='left', show_frame=False))"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
